package com.melody.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.melody.model.vo.MusicSearchVo;
import com.melody.mapper.MusicSearchMapper;
import com.melody.service.MusicSearchService;
import org.springframework.stereotype.Service;
/**
 * @author hq
 * @description 针对表【music_info(歌曲表)】的数据库操作Service实现
 * @createDate 2025-05-12 10:31:17
 */
@Service
public class MusicSearchServiceImpl extends ServiceImpl<MusicSearchMapper, MusicSearchVo> implements MusicSearchService {
    @Override
    public Page<MusicSearchVo> searchMusic(String keyword, Page<MusicSearchVo> page) {
        QueryWrapper<MusicSearchVo> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("music_name", keyword)
                .or()
                .like("singer", keyword)
                .eq("is_delete", 0); // 确保只查询未删除的记录
        return this.page(page, queryWrapper);
    }
}


